// MSGStatusCallback.h: interface for the status_call_back_impl class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MSGSTATUSCALLBACK_H__7103146A_7662_43EE_B57B_7282C00F29BE__INCLUDED_)
#define AFX_MSGSTATUSCALLBACK_H__7103146A_7662_43EE_B57B_7282C00F29BE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <interface/file_trans_client_interface.h>
#include <interface/interface_base.h>
#include "speed_calculator.h"


class status_call_back_impl : public IBindStatusCallback  
{
public:
	status_call_back_impl(_AFT::isession * ptr_session, aot::tt::ievent_base* ptr_notify);
    STDMETHOD(OnStartBinding)(DWORD grfBSCOption, IBinding* pbinding);
	STDMETHOD(GetPriority)(LONG* pnPriority);
	STDMETHOD(OnLowResource)(DWORD dwReserved);
	STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText);
	STDMETHOD(OnStopBinding)(HRESULT hrResult, LPCWSTR szError);
	STDMETHOD(GetBindInfo)(DWORD* pgrfBINDF, BINDINFO* pbindinfo);
	STDMETHOD(OnDataAvailable)(DWORD grfBSCF, DWORD dwSize, FORMATETC *pfmtetc, STGMEDIUM* pstgmed);
	STDMETHOD(OnObjectAvailable)(REFIID riid, IUnknown* punk);
 
    STDMETHODIMP    QueryInterface(REFIID iid, void **ppUnk);
    STDMETHODIMP_(ULONG)    AddRef();
    STDMETHODIMP_(ULONG)    Release();

	void set_cancel(BOOL is_cancel = TRUE)
	{
		this->is_cancel_ = is_cancel;
	}
private:
	DWORD m_cRef;
	LPBINDING       m_pbinding;

	BOOL is_cancel_; 
 	speed_calculator speed_calculator_;
	DWORD last_notify_time_;
	_AFT::isession * ptr_session_; 
	aot::tt::ievent_base* ptr_notify_;
	int i;
	int last_trans_len_;
};

#endif // !defined(AFX_MSGSTATUSCALLBACK_H__7103146A_7662_43EE_B57B_7282C00F29BE__INCLUDED_)
